<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../../print.css" type="text/css" media="print">
<meta content="Connection,com.maclema.mysql.Connection,busy,connected,lastQueryStart,poolSize,totalTX,tx,changeDatabaseTo,connect,createStatement,disconnect,getServerInformation,initConnection" name="keywords">
<title>com.maclema.mysql.Connection</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'Connection - asSQL Documentation';
				var baseRef = '../../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">asSQL Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../all-classes.html')" href="../../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../../index-list.html')" href="../../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../../index.html?com/maclema/mysql/Connection.html&amp;com/maclema/mysql/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;Connection</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a>&nbsp;| <a href="#eventSummary">Events</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class Connection"); titleBar_setSubNav(false,true,false,false,true,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">com.maclema.mysql</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class Connection</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Inheritance</td><td class="inheritanceList">Connection <img class="inheritArrow" alt="Inheritance" title="Inheritance" src="../../../images/inherit-arrow.gif"> flash.events.EventDispatcher</td>
</tr>
</table>
<p></p>
  A Connection is used to manage the creation and connection to a MySql Database.
  <br><br>
  The connection class manages all data input/output from MySql using a Socket connection. Since all 
  operations are asyncronous the Connection class also manages pooling queries and commands so they
  are executed in the order called.
  <p></p>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#busy">busy</a> : Boolean<div class="summaryTableDescription">[read-only]
        Returns true if the connection is currently executing a query
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#connected">connected</a> : Boolean<div class="summaryTableDescription">[read-only]
   Returns true or false indicating if this Connection instance is connected to MySql
   </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#lastQueryStart">lastQueryStart</a> : Number<div class="summaryTableDescription">[read-only]
        Returns the time the last query was executed
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#poolSize">poolSize</a> : int<div class="summaryTableDescription">[read-only]
        Returns the current size of the command pool
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#totalTX">totalTX</a> : Number<div class="summaryTableDescription">[read-only]
        Returns the number of bytes recieved since the connection was opened
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#tx">tx</a> : Number<div class="summaryTableDescription">[read-only]
        Returns the number of bytes recieved since the last query
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Connection()">Connection</a>(host:String, port:int, username:String, password:String = null, database:String = null)</div>
<div class="summaryTableDescription">
   Creates a new Connection instance.</div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#changeDatabaseTo()">changeDatabaseTo</a>(whatDb:String):<a href="../mysql/MySqlToken.html">MySqlToken</a>
</div>
<div class="summaryTableDescription">
        Changes the currently selected database database
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#connect()">connect</a>(charSet:String = "utf8"):void</div>
<div class="summaryTableDescription">
   Opens the socket connection to the server.</div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#createStatement()">createStatement</a>():<a href="../mysql/Statement.html">Statement</a>
</div>
<div class="summaryTableDescription">
         Creates a new statement object
         </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#disconnect()">disconnect</a>():void</div>
<div class="summaryTableDescription">
   Disconnects the socket from the server.</div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#getServerInformation()">getServerInformation</a>():ServerInformation</div>
<div class="summaryTableDescription">
        Returns the server information object for this connection
        </div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#initConnection()">initConnection</a>():void</div>
<div class="summaryTableDescription"></div>
</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
</table>
</div>
<a name="eventSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Events</div>
<table id="summaryTableEvent" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Event</th><th>Summary</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:close">close</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when the connection to the server is terminated.</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:connect">connect</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when successfully connected to the MySql Server
  </td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:ioError">ioError</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatched when a socket error occurs.</td><td class="summaryTableOwnerCol">Connection</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#event:sqlError">sqlError</a>
</div>
</td><td class="summaryTableDescription summaryTableCol">
  Dispatch when an SQL error occurs on connecting to MySql
  </td><td class="summaryTableOwnerCol">Connection</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="busy"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">busy</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>busy:Boolean</code>&nbsp;&nbsp;[read-only]<p>
        Returns true if the connection is currently executing a query
        </p><p>This property can be used as the source for data binding.</p>
<span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get busy():Boolean</code>
<br>
</div>
<a name="connected"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">connected</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>connected:Boolean</code>&nbsp;&nbsp;[read-only]<p>
   Returns true or false indicating if this Connection instance is connected to MySql
   </p><p>This property can be used as the source for data binding.</p>
<span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get connected():Boolean</code>
<br>
</div>
<a name="lastQueryStart"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">lastQueryStart</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>lastQueryStart:Number</code>&nbsp;&nbsp;[read-only]<p>
        Returns the time the last query was executed
        </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get lastQueryStart():Number</code>
<br>
</div>
<a name="poolSize"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">poolSize</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>poolSize:int</code>&nbsp;&nbsp;[read-only]<p>
        Returns the current size of the command pool
        </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get poolSize():int</code>
<br>
</div>
<a name="totalTX"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">totalTX</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>totalTX:Number</code>&nbsp;&nbsp;[read-only]<p>
        Returns the number of bytes recieved since the connection was opened
        </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get totalTX():Number</code>
<br>
</div>
<a name="tx"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">tx</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>tx:Number</code>&nbsp;&nbsp;[read-only]<p>
        Returns the number of bytes recieved since the last query
        </p><span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get tx():Number</code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="Connection()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Connection</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function Connection(host:String, port:int, username:String, password:String = null, database:String = null)</code><p>
   Creates a new Connection instance.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">host</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">port</span>:int</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">username</span>:String</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">password</span>:String</code> (default = <code>null</code>)<code></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">database</span>:String</code> (default = <code>null</code>)<code></code></td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="changeDatabaseTo()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">changeDatabaseTo</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function changeDatabaseTo(whatDb:String):<a href="../mysql/MySqlToken.html">MySqlToken</a></code><p>
        Changes the currently selected database database
        </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">whatDb</span>:String</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../mysql/MySqlToken.html">MySqlToken</a></code></td>
</tr>
</table>
</div>
<a name="connect()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">connect</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function connect(charSet:String = "utf8"):void</code><p>
   Opens the socket connection to the server. You can optionally specify a character set. The specified charset
   should match a charset found in INFORMATION_SCHEMA.CHARACTER_SETS of the MySql database you are connecting
   to. It will then be converted to a compatible actionscript character set name and used for the duration of
   the connection. The default character set if utf8;
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">charSet</span>:String</code> (default = "<code>utf8</code>")<code></code></td>
</tr>
</table>
</div>
<a name="createStatement()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">createStatement</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function createStatement():<a href="../mysql/Statement.html">Statement</a></code><p>
         Creates a new statement object
         </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../mysql/Statement.html">Statement</a></code></td>
</tr>
</table>
</div>
<a name="disconnect()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">disconnect</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function disconnect():void</code><p>
   Disconnects the socket from the server.
   </p></div>
<a name="getServerInformation()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">getServerInformation</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function getServerInformation():ServerInformation</code><p>
        Returns the server information object for this connection
        </p><p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>ServerInformation</code></td>
</tr>
</table>
</div>
<a name="initConnection()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">initConnection</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function initConnection():void</code>
</div>
<div class="detailSectionHeader">Event detail</div>
<a name="event:close"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">close</td><td class="detailHeaderType">event&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.Event</code></a>
<br>
<p></p><p>
  Dispatched when the connection to the server is terminated.
  </p></div>
<a name="event:connect"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">connect</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.Event</code></a>
<br>
<p></p><p>
  Dispatched when successfully connected to the MySql Server
  </p></div>
<a name="event:ioError"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">ioError</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href=""><code>flash.events.IOErrorEvent</code></a>
<br>
<p></p><p>
  Dispatched when a socket error occurs.
  </p></div>
<a name="event:sqlError"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">sqlError</td><td class="detailHeaderType">event&nbsp;</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<span class="label">Event object type: </span><a href="events/MySqlErrorEvent.html"><code>com.maclema.mysql.events.MySqlErrorEvent</code></a>
<br>
<p></p><p>
  Dispatch when an SQL error occurs on connecting to MySql
  </p></div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">http://assql.googlecode.com</center>
</div>
</body>
</html>
<!--http://assql.googlecode.com-->
